﻿using UnityEngine;
using System.Collections;

public class MathUtil
{
    /// <summary>
    /// return a gauss random number 
    /// </summary>
    /// <param name="aim"></param>
    /// <param name="radius"></param>
    /// <returns></returns>
    public static float GaussRand( float aim, float radius, int iterateTimes = 4 )
    {
        float res = 0.0f;
        float minNum = aim - radius;
        float maxNum = aim + radius;

        for (int i = 0; i < iterateTimes; i++ )
        {
            res += Random.Range(minNum, maxNum);
        }
        res /= iterateTimes;

        return res;
    }
}
